/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pl.cezary.butler.walili.server.shuffling;

import java.util.Comparator;
import pl.cezary.butler.walili.client.DownloadTask;
import pl.cezary.butler.walili.client.utils.DomainComparator;

/**
 *
 * @author czarek
 */
public class DownloadTaskShufflingComparator extends ShufflingComparator<DownloadTask> {

    private final Comparator<String> cmp = DomainComparator.getInstance();

    public DownloadTaskShufflingComparator() {
        super(new GapIdGenerator(512));
    }
    
    
    
    @Override
    protected boolean similarityTest(DownloadTask o1, DownloadTask o2) {
         return Math.abs(cmp.compare(o1.getUrl().getHost(), o2.getUrl().getHost()))<10;
    }
    
}
